﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CpEditUser.aspx.cs" Inherits="ReportMobile.admin.CpEditUser" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>用户信息</title>
    <link rel="Stylesheet" type="text/css" href="../css/bootstrap.css" />
    <script type="text/javascript" src="../js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="../js/jquery.form.js"></script>
    <script type="text/javascript" src="../js/xyr.js"></script>
    <script type="text/javascript" src="../js/bootstrap.min.js"></script>
    <script type="text/javascript">
        $(function () {
            var goUrl = 'admincp.aspx?sfrost=';
            $("#btnReturn").click(function () {
                history.back(-1);
            });
            $("#btnEditReturn").click(function () {
                history.back(-1);
            });
            $("#btnEditSubmit").click(function () {
//                if (CheckInput() == false) return;
                $("#fmEditUser").ajaxSubmit({
                    success: function (res) {
                        if (res.err > 0) {
                            alert(res.msg);
                            location.href = goUrl;
                        } else {
                            alert(res.msg);
                        }
                    }
                });
            });
            $("#btnSubmit").click(function () {
//                if (CheckInput() == false) return;
                $("#fmAddUser").ajaxSubmit({
                    success: function (res) {
                        if (res.err > 0) {
                            alert(res.msg);
                            location.href = goUrl;
                        } else {
                            alert(res.msg);
                        }
                    }
                });
            });
        });
    
    </script>
    <style type="text/css">
        textarea{ width:80%; height: 8em;}
    </style>
</head>
<body class="container">
<%
    if (Request.QueryString["type"] != null && Request.QueryString["type"] == "add")
    {
%>
<h1>添加用户</h1>
    <form id="fmAddUser" action="inc/IncAdmin.ashx?type=add" method="post">
        <p>姓名：<input type="text" name="fmUserName" id="fmUserName" value="" title="用户姓名" /></p>
        <p>账号：<input type="text" name="fmOaId" id="fmOaId" value="" title="用户OA账号" /></p>
        <p>
            可查询品类：<br />
            <textarea name="fmVariety"></textarea>
        </p>
        <p>可查询范围：<input type="text" name="fmUnitId" id="fmUnitId" value="" /></p>
        <p>
            自定义范围：<br />
            <textarea name="fmUnitCustom"></textarea>
        </p>
        <p>
            <input type="button" id="btnReturn" name="btnReturn" value="返回" />
            <input type="button" id="btnSubmit" name="btnSubmit" value="保存" />
        </p>
    </form>
<%
    }
    if (Request.QueryString["type"] != null && Request.QueryString["type"] == "edit" && Request.QueryString["id"] != null)
    {
        if (isHaveUser)
        {
%>
<h1>修改用户信息：<%=drUserInfo["fname"] %></h1>
    <form id="fmEditUser" action = "inc/IncAdmin.ashx?type=edit" method = "post">
        <p>姓名：<input type="text" name="fmUserName" id="Text1" value="<%=drUserInfo["fname"] %>" /></p>
        <p>账号：<input type="text" name="fmOaId" id="Text2" value="<%=drUserInfo["foaid"] %>" disabled="disabled" /></p>
        <p>
            可查询品类：<br />
            <textarea name="fmVariety"><%=drUserInfo["fvariety"] %></textarea>
        </p>
        <p>可查询范围：<input type="text" name="fmUnitId" id="Text4" value="<%=drUserInfo["funitid"] %>" /></p>
        <p>
            自定义范围：<br />
            <textarea name="fmUnitCustom"><%=drUserInfo["funitcustom"] %></textarea>
        </p>
        <p>
            <input type="hidden" id="fmId" name="fmId" value="<%=drUserInfo["fid"] %>" />
            <%--<input type="hidden" id="fmoaid" name="fmoaid" value="<%=drUserInfo["foaid"] %>" />--%>
            <input type="button" id="btnEditReturn" name="btnReturn" value="返回" />
            <input type="button" id="btnEditSubmit" name="btnSubmit" value="保存" />
        </p>
    </form>
<%
        }
        else
        {
            Response.Write("用户不存在，请检查");
            return;
        }
    }
%>
</body>
</html>
